# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=gtkspell

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.0.16
pkgrel=1
pkgdesc="Provides word-processor-style highlighting and replacement of misspelled words in a GtkTextView widget (mingw-w64)"
arch=('any')
url="http://gtkspell.sourceforge.net/"
license=("GPL")
makedepends=("gtk-doc"
            "${MINGW_PACKAGE_PREFIX}-gcc"
            "${MINGW_PACKAGE_PREFIX}-pkg-config"
            "intltool")
depends=("${MINGW_PACKAGE_PREFIX}-gtk2"
        "${MINGW_PACKAGE_PREFIX}-enchant")
options=(!libtool strip staticlibs)
source=(http://gtkspell.sourceforge.net/download/${_realname}-${pkgver}.tar.gz
        gtkspell-no-undefined.patch)
md5sums=('f75dcc9338f182c571b321d37c606a94'
         '0ea2a6801314e22ba8e517fca4ad3066')

prepare() {
  cd ${_realname}-$pkgver
  patch -p1 -i ${srcdir}/gtkspell-no-undefined.patch
  
  WANT_AUTOMAKE=latest autoreconf -fi
}

build() {
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-shared \
    --disable-static
  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="$pkgdir" install
}
